import axios from 'axios';

const API = {
    QUERY_ALERT_LIST: '/warn/selectAll'
};

export const models = {
    name: 'userPage',
    model: {
        state: {
            selectedRowkeys:[],
            alertList: [],
        },
        reducers: {
            setState(state, payLoad) {
                return {
                    ...state,
                    ...payLoad
                }
            }
        },
        effects: dispatch => {
            return {
                // async getMemberList() {
                //     const { code, data } = await axios.post(API.QUERY_MEMBER_LIST);
                //     code === 0 && dispatch.adminPage.setState({memberList: data})
                // },
                // async getUnitList() {
                //     const { code, data } = await axios.post(API.QUERY_MEMBER_LIST);
                //     code === 0 && dispatch.adminPage.setState({unitList: data})
                // },
                async getAlertList() {
                    const { code, data } = await axios.post(API.QUERY_ALERT_LIST);
                    code === 0 && dispatch.adminPage.setState({alertList: data})
                },
            }
        }
    }
};
